/**
 * Created by no1 on 2015/6/30.
 */
'use strict';

/**
 * Module district.
 */

let mongoose = require('mongoose');
//let district = require('../schema/district');

var ObjectId = mongoose.Schema.ObjectId;
var Schema = mongoose.Schema;

var district = new Schema({
    //名字
    name: String,
    //编号
    code: {type: Number, unique: true},
    //父级编号
    pCode: Number,
    //中心坐标
    loc: {type: [Number], index: true},
    level: Number,
    //状态 0 没有 1 有
    status: Number,
    //最后更新时间
    updateAt: {
        type: Date,
        index: true,
        "default": Date.now
    },
    //创建时间
    ts: {
        type: Date,
        index: true,
        "default": Date.now
    }
});

district.index({
    'code': 1,
    'level': 1
});

module.exports = mongoose.model('district', district);